<?
	$objConnect = mysql_connect("localhost","root","");
	$objDB = mysql_select_db("db_sipemenang");

	$strUsername = $_POST["strUser"];
	$strPassword = $_POST["strPass"];
	$strSQL = "SELECT * FROM agen WHERE 1 
		AND username = '".$strUsername."'  
		AND password = '".$strPassword."'  
		";

	$objQuery = mysql_query($strSQL);
	$objResult = mysql_fetch_array($objQuery);
	$intNumRows = mysql_num_rows($objQuery);
	if($intNumRows==0)
	{
		$arr['StatusLogin'] = "0"; 
		$arr['id_agen'] = "0"; 
		$arr['Error'] = "Incorrect Username and Password";	
	}
	else
	{
		$arr['StatusLogin'] = "1"; 
		$arr['id_agen'] = $objResult["id_agen"]; 
		$arr['Error'] = "";	
	}

	/**
		$arr['StatusID'] // (0=Failed , 1=Complete)
		$arr['sid'] // sid
		$arr['Error' // Error Message
	*/
	
	mysql_close($objConnect);
	
	echo json_encode($arr);
?>